using Minio;

namespace MinioDemo
{
    public class Program
    {
        /*
            endpoint  <Domain-name> or <ip:port> of your object storage
            accessKey  User ID that uniquely identifies your account
            secretKey  Password to your account
            secure     boolean value to enable/disable HTTPS support (default=true)
         */
        private static string endpoint = "127.0.0.1:9000";
        private static string accessKey = "minioadmin";
        private static string secretKey = "minioadmin";

        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);

            // Add services to the container.

            builder.Services.AddControllers();
            // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
            builder.Services.AddEndpointsApiExplorer();
            builder.Services.AddSwaggerGen();

            // Add Minio using the default endpoint
            // builder.Services.AddMinio(accessKey, secretKey);

            // Add Minio using the custom endpoint and configure additional settings for default MinioClient initialization
            //builder.Services.AddMinio(configureClient => configureClient
            //    .WithEndpoint(endpoint)
            //    .WithCredentials(accessKey, secretKey).WithSSL(false).Build());

            // NOTE: SSL and Build are called by the build-in services already.

            // var ss = builder.Services.BuildServiceProvider().GetService<IMinioClient>();
            var app = builder.Build();

            // Configure the HTTP request pipeline.
            if (app.Environment.IsDevelopment())
            {
                app.UseSwagger();
                app.UseSwaggerUI();
            }

            app.UseAuthorization();

            app.MapControllers();

            app.Run();
        }
    }
}